package com.mzj.saas.mservice.department.mapper;

import com.mzj.saas.mservice.department.vo.DepartmentVO;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DepartmentRowMapper implements RowMapper<DepartmentVO> {
    @Override
    public DepartmentVO mapRow(ResultSet rs, int rowNum) throws SQLException {

        DepartmentVO vo = new DepartmentVO();
        vo.setId(rs.getLong("id"));
        vo.setParentId(rs.getLong("parent_id"));
        vo.setName(rs.getString("name"));
        vo.setProvinceId(rs.getLong("province_id"));
        vo.setCityId(rs.getLong("city_id"));
        vo.setDistrictId(rs.getLong("district_id"));
        vo.setStreetId(rs.getLong("street_id"));
        vo.setCode(rs.getString("code"));
        vo.setSortby(rs.getInt("sortby"));
        vo.setType(rs.getInt("type"));
        vo.setIcon(rs.getString("icon"));
        vo.setStatus(rs.getInt("status"));
        vo.setLevel(rs.getInt("level"));
        vo.setMaxNum(rs.getInt("max_num"));
        vo.setOwnerType(rs.getInt("owner_type"));
        vo.setCreateTime(rs.getDate("create_time"));
        vo.setDecription(rs.getString("decription"));

        return vo;
    }
}
